package initialize

import (
	"context"
	"fmt"
	"github.com/go-redis/redis/v8"
	"onerk4/zk2/common/global"
)

func RedisInit() {
	nac := global.AppConfig.Nacos.Redis
	global.Rdb = redis.NewClient(&redis.Options{
		Addr:     nac.Addr,
		Password: nac.Password, // no password set
		DB:       0,            // use default DB
	})
	_, err := global.Rdb.Ping(context.Background()).Result()
	if err != nil {
		panic(err)
	}
	fmt.Println("redis init success")
}
